﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Threading;
using System.Web;

namespace Midas
{
    /// <summary>
    /// STILL UNDER CONSTRUCTION
    /// </summary>
    public static class _mailer
    {
        //private static string FromEmailAddress = "";
        //private static string SMTPServerIP = "209.61.151.224";
        //public static string username = "postmaster@appa0aae4bc7ec347238239e0d4c07792fa.mailgun.org";
        //public static string password = "ffe2f6359b01644aad4452f9bee91926";
        //public static string ErrorAddress = "";

        //public static bool SendEmail(string toEmail, string subject, string body)
        //{
        //    try
        //    {
        //        using (MailMessage EmailMessage = new MailMessage())
        //        {
        //            EmailMessage.From = new MailAddress(FromEmailAddress);
        //            EmailMessage.IsBodyHtml = false;
        //            EmailMessage.To.Add(new MailAddress(toEmail));
        //            EmailMessage.Subject = subject;
        //            EmailMessage.Body = body;

        //            using (SmtpClient SendingClient = new SmtpClient(SMTPServerIP, 587))
        //            {
        //                SendingClient.Credentials = new System.Net.NetworkCredential(username, password);
        //                SendingClient.Send(EmailMessage);
        //            }
        //        }
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        if (toEmail != ErrorAddress)
        //            SendEmail(ErrorAddress, "Error: " + ex.GetType().Name, ex.StackTrace);
        //        Thread.Sleep(TimeSpan.FromMinutes(5));
        //    }
        //    return false;
        //}
    }
}